<?php 
	use Zend\Session\Container; 
    $SESSION = new Container('user');
	$money=0;
	if(isset($data['infoCustomers'][0]['money']))
	{
		$money=$data['infoCustomers'][0]['money'];
	}
?>
<!DOCTYPE html>
<html>

<body>

<!--CONTENT SECTION START-->

<div id="main-wrapper-sec">

<section>

	<!--INNER MAIN TITLE SECTION START-->

    <h2 class="inner-main-title pr-title">login</h2>
    
    <!--INNER MAIN TITLE SECTION END-->
    
    <!--CONTENT MAIN SECTION START-->
    
  <div class="content-main-sec">
  
  <!--INNER CONTENT LEFT MENU SECTION START-->
  
  <ul class="inner-left-menu-sec">
    <?php include('cleftmenu.phtml');?>
  </ul>
  
  <!--INNER CONTENT LEFT MENU SECTION END-->
  
  <!--INNER CONTENT RIGHT SECTION START-->
  
  <article class="inner-cont-right-sec">
  <h1 class="inner-cont-title">Packages</h1>
	  <ul class="acc-sd-sec">
	  <!-- <li>
	  <div class="pa-st-sec"><img src="<?php echo $this->basePath(); ?>/images/packages-icon.png" alt="">View Packages</div>
	  <div class="pa-st-sec"><img src="<?php echo $this->basePath(); ?>/images/package-history-icon.png" alt="">Package History</div>
	  </li>-->
	  <li><a href="<?php echo $this->url('cpackages-1', array('action' => 'cpackages-1')); ?>" class="pa-st-sec" ><img src="<?php echo $this->basePath(); ?>/images/packages-icon.png" alt="">View Packages</a> <!-- <a href="<?php //echo $this->url('cpackages-history', array('action' => 'cpackages-history')); ?>" class="pa-st-sec" ><img src="<?php //echo $this->basePath(); ?>/images/package-history-icon.png" alt="">Package History</a>--> </li>
	  </ul>
  <div class="clear"></div><br/><br/>
	  <ul class="pa-fu-dt-sec">
	  <?php if(isset($pakage)){ for($i=0;$i<count($pakage['infoSuites']);$i++) { if(substr($pakage['infoSuites'][$i]['name'],0,2)=="PK"){ ?>
	  <li style="text-align:center">
		<h1>
			<?php 
			if(isset($pakage['infoSuites'][$i]['name'])){
			$pakageName=explode("-",$pakage['infoSuites'][$i]['name']);	
			echo $pakageName[1];
			} 
			?>
		</h1>
		<h2><?php if(isset($pakage['infoSuites'][$i]['infoGiftTimes'][0]['giftTime'])){ echo $pakage['infoSuites'][$i]['infoGiftTimes'][0]['giftTime']." min";} ?> </h2>
		<h3><?php if($pakage['infoSuites'][$i]['rentType']=="1"){ echo '30 days'; } ?></h3>
		<h2><?php $a=$pakage['infoSuites'][$i]['id']."@".$pakage['infoSuites'][$i]['rentFee'];echo $pakage['infoSuites'][$i]['rentFee']; ?>$ USD</h2>
		<p><?php if(isset($pakage['infoSuites'][$i]['memo'])){
		$memo =explode(",",$pakage['infoSuites'][$i]['memo']);
		for($j=0;$j<count($memo);$j++){
		echo $memo[$j]."<br>"; } } ?>
		</p>
		<div class="bn-but"><a href="javascript:void(0);" id="open-pop-up-3" onclick="ratesValues('<?php echo $a; ?>')">buy now</a></div>
	  </li>
	  <?php } } } ?>
	  </ul>
  <div class="clear"></div>
  <form id="formid" method="POST" action="<?php echo $this->url('paypakage', array('action' => 'paypakage')); ?>" />
	<input type="hidden" name="money" id="money" value="<?php echo $money; ?>" />
    <input type="hidden" name="amount" id="amount" value="" />
  </form>
  <!--INNER CONTENT RIGHT SECTION END-->
	<form id="paypal" method="post" action="<?php echo $this->url('cpayments', array('action' => 'cpayments')); ?>" />
	<input type="hidden" id="payers_account" name="payers_account" value="<?php echo $SESSION['uname']; ?>" />
	<input type="hidden" id="payment_amount" name="payment_amount" value="" />
	</form>
  <!--CLIENTS AREA SECTION START-->
  
  </article>
  
  <!--INNER CONTENT RIGHT SECTION END-->
  
  </div>
  
  <div class="clear"></div>
  
  <!--CLIENTS AREA SECTION START-->
  
  <aside class="content-main-sec ot-lg-sec"> <img src="<?php echo $this->basePath(); ?>/images/truste.jpg" alt=""> <img src="<?php echo $this->basePath(); ?>/images/secured.jpg" alt=""> <img src="<?php echo $this->basePath(); ?>/images/mcafeev.jpg" alt="">
    <h3 class="otg-title">Trusted. Safe. Reliable.</h3>
  </aside>
  
  <!--CLIENTS AREA SECTION END-->
  
  <div class="clear"></div>
  
</section>
<div id="pop-up-3" class="pop-up-display-content">
		<h2 class="popup_heding">Confirm Message</h2>
		<p class="popup_test">You are going to purchase this package and the amount will be deducted</p>
</div>
</div>

<!--CONTENT SECTION END--> 

</body>
</html>
<script>
    function ratesValues(id){
		var id=id;
		var arr = id.split('@');
		$('#payment_amount').val(id);
		$('#amount').val(id);
		var money=$('#money').val();
		if(money >= parseInt(arr[1])){
		
			$('#pop-up-3').popUpWindow({
				action: "open",
				buttons: [{
					text: "OK",
					cssClass: "btn-yes_p",
					click: function () {
						$("#formid").submit();
					}
				}, {
					text: "Cancel",
					cssClass: "btn-no_p",
					click: function () {
						this.close();
					}
				}]
			});
		}else{
			$('#pop-up-3').popUpWindow({
				action: "open",
				buttons: [{
					text: "OK",
					cssClass: "btn-yes_p",
					click: function () {
						$("#paypal").submit();
					}
				}, {
					text: "Cancel",
					cssClass: "btn-no_p",
					click: function () {
						this.close();
					}
				}]
			});
		}
	}
</script>